using System;
using System.IO;
using Newtonsoft.Json;

public class Request {
    public string? Module { get; set; }
    public string? Action { get; set; }
    public dynamic? Data { get; set; }
}

public class Response {
    public string? Status { get; set; }
    public string? Message { get; set; }
    public dynamic? Data { get; set; }
}

class Program {
    static void Main(string[] args) {
        using (var reader = new StreamReader(Console.OpenStandardInput()))
        using (var writer = new StreamWriter(Console.OpenStandardOutput())) {
            writer.AutoFlush = true;
            while (true) {
                var input = reader.ReadLine();
                if (input == null) break;

                var response = new Response { Status = "error", Message = "Invalid input" };
                if (input.StartsWith("{")) {
                    var request = JsonConvert.DeserializeObject<Request>(input);
                    response = new Response { Status = "error", Message = "Unknown request" };
                    if (request != null) {
                        response = HandleRequest(request);
                    }
                }
                var jsonResponse = JsonConvert.SerializeObject(response);
                writer.WriteLine(jsonResponse);
            }
        }
    }

    static Response HandleRequest(Request request) {
        switch (request.Module) {
            case "user":
                return HandleUserRequest(request);
            case "article":
                return HandleArticleRequest(request);
            default:
                return new Response { Status = "error", Message = "Unknown module" };
        }
    }

    static Response HandleUserRequest(Request request) {
        switch (request.Action) {
            case "create":
                // Implement user creation logic here
                return new Response { Status = "success", Message = "User created", Data = request.Data };
            case "read":
                // Implement user read logic here
                return new Response { Status = "success", Message = "User details", Data = request.Data };
            case "update":
                // Implement user update logic here
                return new Response { Status = "success", Message = "User updated", Data = request.Data };
            case "delete":
                // Implement user deletion logic here
                return new Response { Status = "success", Message = "User deleted", Data = request.Data };
            default:
                return new Response { Status = "error", Message = "Unknown action" };
        }
    }

    static Response HandleArticleRequest(Request request) {
        switch (request.Action) {
            case "create":
                // Implement article creation logic here
                return new Response { Status = "success", Message = "Article created", Data = request.Data };
            case "read":
                // Implement article read logic here
                return new Response { Status = "success", Message = "Article details", Data = request.Data };
            case "update":
                // Implement article update logic here
                return new Response { Status = "success", Message = "Article updated", Data = request.Data };
            case "delete":
                // Implement article deletion logic here
                return new Response { Status = "success", Message = "Article deleted", Data = request.Data };
            default:
                return new Response { Status = "error", Message = "Unknown action" };
        }
    }
}
